import os
import unittest
from XTestRunner import HTMLTestRunner
from config import BASE_PATH

if __name__ == "__main__":
    # 套件
    suite = unittest.TestLoader().discover(BASE_PATH + os.sep + 'scripts', 'test_home_sniffing.py')
    # 执行并生成测试报告
    file_path = BASE_PATH + os.sep + 'report' + os.sep + 'InSaver_sniffing.html'
    with(open(file_path, 'wb')) as fp:
        runner = HTMLTestRunner(
            stream=fp,
            title='InSaver解析测试报告',
            description='InSaver解析 1.0.0 by曾伟雄',
            language='zh-CN',
            tester='曾伟雄'
            # rerun=1  # 容错机制重试1次
        )
        runner.run(suite)

